<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ProductSearch.aspx.cs" Inherits="ProductSearch" title="Project Monitoring System" culture="auto:en-US" uiculture="auto" meta:resourcekey="PageResource1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server" Visible="false">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    <div style="padding: 10px">
        <fieldset>
            <legend>
                <asp:Label ID="lblProductListStatic" runat="server" Text="Product List" meta:resourcekey="lblProductListStaticResource1"></asp:Label>
            </legend>
            <div style="padding-top: 10px" />
            <table style="width: 432px">
                <tr>
                    <td style="vertical-align: top; width: 282px; text-align: right">
                        <asp:Label ID="lblSearch" runat="server" Text="Search" Width="100%" meta:resourcekey="lblSearchResource1"></asp:Label></td>
                    <td>
                        <asp:ObjectDataSource ID="ODSProducts" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="GetProducts" TypeName="IPTableAdapters.ProductTableAdapter">
                            <SelectParameters>
                                <asp:SessionParameter DefaultValue="False" Name="SuperUser" SessionField="SuperUser"
                                    Type="Boolean" />
                                <asp:SessionParameter DefaultValue="" Name="OwnerGroupID" SessionField="OwnerGroupID"
                                    Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:DropDownList ID="ddlProduct" runat="server" AutoPostBack="True" DataSourceID="ODSProducts"
                            DataTextField="ModelName" DataValueField="Model" OnSelectedIndexChanged="ddlProduct_SelectedIndexChanged"
                            Width="222px" meta:resourcekey="ddlProductResource1" OnPreRender="ddlProduct_PreRender">
                        </asp:DropDownList></td>
                    <td style="width: 34px">
                        </td>
                </tr>
                <tr>
                    <td style="vertical-align: top; width: 282px; text-align: right">
                        <asp:Label ID="lblAdd" runat="server" Text="Model" Width="100%" meta:resourcekey="lblAddResource1"></asp:Label></td>
                    <td>
                        <asp:TextBox ID="txtAdd" runat="server" meta:resourcekey="txtAddResource1" MaxLength="30" Width="216px"></asp:TextBox></td>
                    <td style="width: 34px">
                        <asp:Button ID="btnAdd1" runat="server" CausesValidation="False" CssClass="submit"
                            Text="Add" Width="76px" OnClick="btnAdd1_Click" meta:resourcekey="btnAdd1Resource1" Visible="False" /></td>
                </tr>
            </table>
        </fieldset>
    </div>
    <div style="padding: 10px">
        <fieldset style="text-align: center; height: 480px;">
            <legend>
                <asp:Label ID="lblSearchResult" runat="server" Text="Search Result" meta:resourcekey="lblSearchResultResource1"></asp:Label>
            </legend>
            <br />
            <table style="width: 687px; height: 72%;">
                <tr>
                    <td style="vertical-align: middle; width: 166px; text-align: right">
                        <asp:Label ID="lblModelNo" runat="server" Font-Bold="True" Font-Names="helvetica"
                            Text="Model No.:" Width="100%" meta:resourcekey="lblModelNoResource1"></asp:Label></td>
                    <td style="vertical-align: top; width: 269px; text-align: left">
                        <asp:Label ID="lblModelHere" runat="server" Font-Bold="True" Font-Names="helvetica" Font-Size="Medium"
                            Width="100%" meta:resourcekey="lblModelHereResource1"></asp:Label></td>
                    <td>
                        &nbsp;<asp:Button ID="btnAddProduct" runat="server" Text="Add Product" OnClick="btnAddProduct_Click" meta:resourcekey="btnAddProductResource1" /></td>
                    <td style="width: 71px">
                        <asp:Button ID="btnAddProjectToProduct" runat="server" Text="Add Project To Product" meta:resourcekey="btnAddProjectToProductResource1" /></td>
                    <td style="width: 71px">
                    </td>
                </tr>
                <tr>
                    <td colspan="5" style="width: 166px; height: 15px">
                    </td>
                </tr>
                <tr>
                    <td style="height: 21px; text-align: left; vertical-align: top;" colspan="5">
                        <asp:ObjectDataSource ID="ODSProjectList" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="GetProjectList" TypeName="IPTableAdapters.taGetProductSearchSp">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="lblModelHere" Name="Model" PropertyName="Text"
                                    Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <table width="100%">
                            <tr>
                                <td align="center">
                                    <asp:Label ID="lblError" runat="server" CssClass="error" ForeColor="Red" Width="100%" meta:resourcekey="lblErrorResource1"></asp:Label>
                                </td>
                            </tr>
                        </table>
                        <asp:Panel ID="Panel1" runat="server" Height="300px" ScrollBars="Auto" Width="100%" meta:resourcekey="Panel1Resource1" BorderWidth="1px">
                            <asp:GridView CssClass="Grid" ID="gvResults" runat="server" AutoGenerateColumns="False" BackColor="#DEBA84"
                                BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2"
                                DataSourceID="ODSProjectList" Height="1px" DataKeyNames="ProjectCode" meta:resourcekey="gvResultsResource1" AllowPaging="True" >
                                <FooterStyle CssClass="GridFooterStyle" BackColor="#F7DFB5" ForeColor="#8C4510" />
                                <Columns>
                                    <asp:BoundField DataField="projectcode" HeaderText="Project Code" SortExpression="projectcode" meta:resourcekey="BoundFieldResource1">
                                        <ItemStyle Width="120px" Wrap="False" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="country" HeaderText="Country" SortExpression="country" meta:resourcekey="BoundFieldResource2">
                                        <ItemStyle Width="150px" Wrap="False" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="title" HeaderText="Title" SortExpression="title" meta:resourcekey="BoundFieldResource3">
                                        <ItemStyle Width="200px" Wrap="False" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" meta:resourcekey="BoundFieldResource4">
                                        <ItemStyle Width="100px" Wrap="False" />
                                    </asp:BoundField>
                                    <asp:TemplateField HeaderText="Delete" meta:resourcekey="TemplateFieldResource1">
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle CssClass="GridHeaderStyle" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            &nbsp;<asp:CheckBox ID="cbDelete" runat="server" meta:resourcekey="cbDeleteResource1" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <RowStyle CssClass="GridRowStyle" BackColor="#FFF7E7" ForeColor="#8C4510" />
                                <SelectedRowStyle CssClass="GridSelectedRowStyle" BackColor="#738A9C" Font-Bold="False" ForeColor="White" />
                                <PagerStyle CssClass="GridPagerStyle" ForeColor="#8C4510" HorizontalAlign="Center" />
                                <HeaderStyle CssClass="GridHeaderStyle" BackColor="DarkBlue" Font-Bold="True" ForeColor="White" />
                            </asp:GridView>
                        </asp:Panel>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="5" style="vertical-align: top; height: 15px; text-align: right">
                        <asp:Button ID="btnDelete" runat="server" CssClass="submit" OnClick="btnDelete_Click"
                            Text="Delete" meta:resourcekey="btnDeleteResource1" /></td>
                </tr>
            </table>
            <a href="App_Code/IP.xsd"><span style="color: #0000ff"></span></a>
        </fieldset>
    </div>
    <asp:Panel ID="Panel2" runat="server" Height="350px" Style="display: none" CssClass="modalPopup"
        Width="467px" meta:resourcekey="Panel2Resource1">
        <asp:Panel ID="Panel3" runat="server" Style="cursor: move; background-color: #DDDDDD;
            border: solid 1px Gray; color: Black" Width="100%" Height="20px" meta:resourcekey="Panel3Resource1">
            <div>
                <p style="width: 100%">
                    Choose the Project(s) you like to add:</p>
            </div>
        </asp:Panel>
        <asp:ObjectDataSource ID="ODSProject" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="GetProjectsNotAssignedYet" TypeName="IPTableAdapters.ProjectNotAssignedYetTableAdapter">
            <SelectParameters>
                <asp:ControlParameter ControlID="lblModelHere" DefaultValue="x" Name="Model" PropertyName="Text"
                    Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <table border=none style="width: 401px" align="center">
            <tr>
                <td align="center">
            <asp:Button ID="OkButton" runat="server" Text="OK" CssClass="submit" OnClick="OkButton_Click" meta:resourcekey="OkButtonResource1" /></td>
                <td align="center">
            <asp:Button ID="CancelButton" runat="server" Text="Cancel" CssClass="reset" meta:resourcekey="CancelButtonResource1" Width="109px" /></td>
            </tr>
        </table>
        <asp:UpdatePanel id="UpdatePanel1" runat="server">
            <contenttemplate>
<asp:Panel id="Panel4" runat="server" meta:resourcekey="Panel4Resource1" Width="464px" ScrollBars="Vertical" Height="130%">
<DIV style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px"><asp:GridView id="gvAddProject" runat="server" meta:resourcekey="gvAddProjectResource1" Width="450px" DataSourceID="ODSProject" CssClass="Grid" BorderWidth="1px" Height="200px" AllowPaging="True" DataKeyNames="ProjectCode" CellSpacing="2" CellPadding="3" BorderStyle="None" BorderColor="#DEBA84" BackColor="#DEBA84" AutoGenerateColumns="False">
<FooterStyle BackColor="#F7DFB5" CssClass="GridFooterStyle" ForeColor="#8C4510"></FooterStyle>
<RowStyle BackColor="#FFF7E7" CssClass="GridRowStyle" ForeColor="#8C4510"></RowStyle>
<Columns>
<asp:TemplateField HeaderText="Select" meta:resourceKey="TemplateFieldResource2"><ItemTemplate>
                                <asp:CheckBox ID="CheckBox1" runat="server" meta:resourcekey="CheckBox1Resource1" />
                            
</ItemTemplate>

<HeaderStyle HorizontalAlign="Center" CssClass="GridHeaderStyle" Width="50px"></HeaderStyle>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="ProjectCode" HeaderText="ProjectCode" ReadOnly="True" SortExpression="ProjectCode" meta:resourceKey="BoundFieldResource5"></asp:BoundField>
<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" meta:resourceKey="BoundFieldResource6"></asp:BoundField>
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" meta:resourceKey="BoundFieldResource7"></asp:BoundField>
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" meta:resourceKey="BoundFieldResource8"></asp:BoundField>
</Columns>

<PagerStyle HorizontalAlign="Center" CssClass="GridPagerStyle" ForeColor="#8C4510"></PagerStyle>

<SelectedRowStyle BackColor="#738A9C" CssClass="GridSelectedRowStyle" Font-Bold="False" ForeColor="White"></SelectedRowStyle>

<HeaderStyle BackColor="DarkBlue" CssClass="GridHeaderStyle" Font-Bold="True" ForeColor="White"></HeaderStyle>
</asp:GridView> </DIV></asp:Panel> 
</contenttemplate>
        </asp:UpdatePanel>
    </asp:Panel>
    <cc1:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="btnAddProjectToProduct"
        PopupControlID="Panel2" BackgroundCssClass="modalBackground" OkControlID="btnAddProjectToProduct" CancelControlID="CancelButton"
        DropShadow="True" PopupDragHandleControlID="Panel3" DynamicServicePath="" Enabled="True" />
</asp:Content>

